﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;

using System.Text;
using System.Windows.Forms;

namespace INSAForManagers
{
    public partial class FormLogin : Form
    {
        
        public FormLogin()
        {
            InitializeComponent();
        }

        private void btnLogin_Click(object sender, EventArgs e)
        {
            string strPW = txtPW.Text;

            //비밀번호 입력 확인
            if (strPW.Length == 0) { 
                MessageBox.Show("비밀번호를 입력하세요!     ","확인",MessageBoxButtons.OK,MessageBoxIcon.Warning);
                txtPW.Focus();
                return;
            }

            string strPWChk = DBUtil.getPasseord();
            if(strPW.Equals(strPWChk)==false){

                MessageBox.Show("비밀번호가 일치하지 않습니다!     ","경고",MessageBoxButtons.OK,MessageBoxIcon.Warning);
                txtPW.Text = "";
                txtPW.Focus();
                return;

            }

            //this.Visible = false;

            MessageBox.Show("로그인하였습니다.   ", "확인", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        
            Config.State = Config.STATE_OK;

            btnCancel.DialogResult = DialogResult.OK;
            btnCancel.PerformClick();

        }

        private void txtPW_KeyPress(object sender, KeyPressEventArgs e)
        {
            if (e.KeyChar == (char)Keys.Enter)
            {
                btnLogin.PerformClick();
            }
        }

    }
}
